/*
# ------------------------------------------------------------------------
# JD Base Theme
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
$(document).ready(function() {
	var hide = function(i) {
		$('#edit-blocks-wrapper').hide();
		$('#edit-regions-wrapper').hide();
		if (i == 2) {
			$('#edit-blocks-wrapper').show();
		}
		if (i == 3) {
			$('#edit-regions-wrapper').show();
		}
	}

	hide($('input[@name=\'subcontent\']:checked').val());
	$('input[@name=\'subcontent\']').change(function() {
		hide($(this).val());
	});
	var submit = false;
	$('#menu-edit-item').submit(function() {
		if (!submit) {
			var url = $('#edit-url').val();
			$('#edit-submit').addClass('ajax-loading');
			$.post(url, $('#jd-menu-params').serialize(), function(i) {
				if (i == 'ok') {
					submit = true;
					$('#edit-submit').click();
				}
			});
		}
		return submit;
	});
});